﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package zasp.Classes {
    import zasp.Util.*;

    public class ZaspTrackerDetail {

        protected static const BUFFER_LENGTH:int = 45;

        protected var bufF2F:CircularBuffer;

        public function ZaspTrackerDetail(){
            this.bufF2F = new CircularBuffer(BUFFER_LENGTH);
            super();
        }
        public function sample(_arg1:String, _arg2:Number, _arg3:Number, _arg4:int):void{
            var _local5:Object;
            while (this.bufF2F.length >= (this.bufF2F.capacity - 1)) {
                _local5 = this.bufF2F.pop();
            };
            if (null == _local5){
                _local5 = new Object();
            };
            _local5.gameState = _arg1;
            _local5.gameNumber = _arg2;
            _local5.dt = _arg3;
            _local5.mem = _arg4;
            this.bufF2F.push(_local5);
        }
        public function report():Object{
            var _local3:Object;
            var _local4:Object;
            var _local1:Object = new Object();
            _local1.buf_length = BUFFER_LENGTH;
            _local1.buf = new Array();
            var _local2:int;
            while (_local2 < this.bufF2F.length) {
                _local3 = this.bufF2F.elementAt(_local2);
                _local4 = new Object();
                _local4.gameState = _local3.gameState;
                _local4.gameNumber = _local3.gameNumber;
                _local4.dt = _local3.dt;
                _local4.mem = _local3.mem;
                _local1.buf[_local2] = _local4;
                _local2++;
            };
            return (_local1);
        }
        public function get f2fBuffer():CircularBuffer{
            return (this.bufF2F);
        }
        public function log_report():void{
            var _local2:Object;
            trace("PERFORMANCE REPORT DETAIL");
            trace(("  BUFFER_LENGTH: " + BUFFER_LENGTH));
            var _local1:int;
            while (_local1 < this.bufF2F.length) {
                _local2 = this.bufF2F.elementAt(_local1);
                trace(("  sample:        " + _local1));
                trace(("    gameState:   " + _local2.gameState));
                trace(("    gameNumber:  " + _local2.gameNumber));
                trace(("    dt:          " + _local2.dt));
                trace(("    mem:         " + _local2.mem));
                _local1++;
            };
        }

    }
}//package zasp.Classes 
